package com.ruoyi.recoverCustomer.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.recoverCustomer.domain.bo.TRecoverCustomerLogBo;
import com.ruoyi.recoverCustomer.domain.vo.TRecoverCustomerLogVo;
import com.ruoyi.recoverCustomer.service.ITRecoverCustomerLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 客户回收记录
 *
 * @author ruoyi
 * @date 2023-08-18
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/recoverCustomerLog")
public class TRecoverCustomerLogController extends BaseController {

    private final ITRecoverCustomerLogService iTRecoverCustomerLogService;

    /**
     * 查询客户回收记录列表
     */
    @GetMapping("/list")
    public TableDataInfo<TRecoverCustomerLogVo> list(TRecoverCustomerLogBo bo, PageQuery pageQuery) {
        return iTRecoverCustomerLogService.queryPageList(bo, pageQuery);
    }

    /**
     * 导出客户回收记录列表
     */
    @Log(title = "客户回收记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(TRecoverCustomerLogBo bo, HttpServletResponse response) {
        List<TRecoverCustomerLogVo> list = iTRecoverCustomerLogService.queryList(bo);
        ExcelUtil.exportExcel(list, "客户回收记录", TRecoverCustomerLogVo.class, response);
    }

}
